import request from '@/utils/request'

/**
 * 获取店铺列表
 * @param {*} params 
 * @returns 
 */
export const shopGetListAPI = (params) => {
    return request.post('/shop/list', params)
}
/**
 * 根据店铺ID获取店铺详情
 * @param {*} shopId 
 * @returns 
 */
export const shopGetInfoAPI = (shopId) => {
    return request.get('/shop/info?shopId=' + shopId)
}
/**
 * 新增店铺
 * @param {*} shop 
 * @returns 
 */
export const shopAddAPI = (shop) => {
    return request.post('/shop/add', shop)
}
/**
 * 更新店铺信息
 * @param {*} shop 
 * @returns 
 */
export const shopUpdateAPI = (shop) => {
    return request.patch('/shop/update', shop)
}
/**
 * 根据店铺ID删除店铺
 * @param {*} shopId 
 * @returns 
 */
export const shopDelAPI = (shopId) => {
    return request.delete('/shop/delete', {
        params: {shopId}
    })
}

export const shopUploadImgAPI = (data) => {
    return request.post('/common/upload', data)
}

export const shopDownloadImgAPI = (filename) => {
    return request.get('/common/download?name='+filename, { responseType: 'blob' })
    // return request.get('/common/download?name='+filename)
}